// Copyright (C) 2012 by Johann Duscher <jonny.dee@gmx.net>
// 
// This file is part of barcodeart-pp.
//
// barcodeart-pp is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// barcodeart-pp is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with barcodeart-pp. If not, see <http://www.gnu.org/licenses/>.

#pragma once

#include <QWidget>
#include <QMap>

#include <barcodeart/barcodeart.hpp>
#include <barcodeart/qrcode/qrcode.hpp>


namespace Ui {
class EncoderConfigView;
}

namespace barcodeart
{

namespace qrcode
{

namespace qrencode
{

class EncoderConfigView : public QWidget, public IEncoderConfigView
{
    Q_OBJECT
    
public:
    explicit EncoderConfigView(IEncoderPluginContext& pluginContext, QWidget *parent = 0);
    ~EncoderConfigView();
    
    void setConfig(const IEncoderConfig& config);
    void getConfig(IEncoderConfig& config) const;

private slots:
    void on_versionSpinBox_valueChanged(int value);
    void on_caseSensitiveCheckBox_stateChanged(int state);
    void on_errorCorrectionLevelComboBox_currentIndexChanged(int index);
    void on_encodingTypeComboBox_currentIndexChanged(int index);

private:
    typedef QMap<ErrorCorrection::Level, QString> ErrorCorrectionLevelStringMap;
    typedef QMap<Encoding::Type, QString> EncodingTypeStringMap;

    IEncoderPluginContext* m_pPluginContext;
    Ui::EncoderConfigView* m_pUI;
    ErrorCorrectionLevelStringMap m_errorCorrectionLevelStringMap;
    EncodingTypeStringMap m_encodingTypeStringMap;


    ErrorCorrection::Level toErrorCorrectionLevel(const QString& value) const;
    QString toErrorCorrectionString(ErrorCorrection::Level value) const;

    Encoding::Type toEncodingType(const QString& value) const;
    QString toEncodingString(Encoding::Type value) const;
};

}

}

}
